package com.huiquan.vocab.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.vocab.domain.VocabDyadRemove;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class VocabDyadRemoveDao extends EnhancedBaseDao<VocabDyadRemove> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "VOCAB_DYAD_REMOVE.";

	public VocabDyadRemoveDao() {
		super(space);
	}

	public VocabDyadRemove retrieveCheckedObjectByDyadStd(String id) {
		return (VocabDyadRemove)this.object(space + "RETRIEVE_CHECKED_OBJECT_BY_DYAD_STD", id, sqlMapClient);
	}

	public void deleteByDyadStd(String id) {
		this.delete(space + "DELETE_BY_DYAD_STD", id, sqlMapClient);
	}

	public Long addRemoveByStdId(String id, String resultArray, String resultPattern) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("resultArray", resultArray);
		param.put("resultPattern", resultPattern);
		
		return (Long) this.insert(space + "ADD_REMOVE_BY_STD_ID", param, sqlMapClient);
	}

	public Long retrieveIdByStdId(String id) {
		
		return (Long)this.object(space + "RETRIEVE_ID_BY_STD_ID", id, sqlMapClient);
	}

	@SuppressWarnings("unchecked")
	public List<String> retrieveRemove4ExportRuleFile(String type) {
		
		return (List<String>) this.list(space + "RETRIEVE_REMOVE_4_EXPORT_RULE_FILE", type, sqlMapClient);
	}
}
